package com.hzcx.app.simplechat.ui.setting.presenter;

import android.app.Activity;
import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.api.BaseObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.bean.UpLoadImgBean;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.ui.publicui.bean.ProtocolBean;
import com.hzcx.app.simplechat.ui.publicui.bean.UpdateVersionBean;
import com.hzcx.app.simplechat.ui.setting.contract.AboutContract;
import com.hzcx.app.simplechat.ui.setting.contract.AddAutoSendMsgContract;
import com.hzcx.app.simplechat.util.app.AppHelper;
import com.hzcx.app.simplechat.util.token.TokenUtils;

public class AboutPresenter extends BasePresenter<AboutContract.View> implements AboutContract.Presenter {

    /**
     *  获取协议内容
     * @param context
     * @param type
     */
    @Override
    public void getProtocol(Context context, String type) {
        PublicModel.getProtocolByType(context, type, new BaseDialogObserver<ProtocolBean>(context) {
            @Override
            protected void onSuccess(ProtocolBean data) {
                mView.protocolResult(data);
            }
        });
    }

    /**
     * 查询版本更新信息
     *
     * @param context
     */
    @Override
    public void updateVersion(Context context) {
        PublicModel.updateVersion(context, "android", AppHelper.getVersionCode(context), new BaseDialogObserver<UpdateVersionBean>(context) {
            @Override
            protected void onSuccess(UpdateVersionBean data) {
                mView.updateVersionResult(data);
            }
        });
    }
}
